package com.ruoyi.integration.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

@Data
@Configuration
@Component
@ConfigurationProperties(prefix = "thirdparty.iot-data-service.dust-monitor-data-service")
public class DustServiceProperties {

    private Auth auth = new Auth();
    private Endpoint endpoint = new Endpoint();
    private List<String> deviceIds = new ArrayList<>();

    @Data
    public static class Auth {

        /**
         * 对应 yaml: thirdparty.iot-data-service.dust-monitor-data-service.auth.token-url
         * hyphen -> 驼峰：token-url -> tokenUrl
         *
         */
        @NotBlank private String tokenUrl;
    }

    @Data
    public static class Endpoint {

        /**
         * 对应 yaml: thirdparty.iot-data-service.dust-monitor-data-service.endpoint.data-url
         * hyphen -> 驼峰：data-url -> dataUrl
         */
        @NotBlank private String dataUrl;
    }

}

